package com.genfu.reform.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.genfu.reform.jpa.NavigationNodeDAO;
import com.genfu.reform.model.NavigationNode;

public class NavigationNodeServiceImpl implements NavigationNodeService {

	private NavigationNodeDAO navigationNodeDAO;

	public NavigationNodeDAO getNavigationNodeDAO() {
		return navigationNodeDAO;
	}

	public void setNavigationNodeDAO(NavigationNodeDAO theDAO) {
		this.navigationNodeDAO = theDAO;
	}

	@Override
	public List<NavigationNode> findAll() {
		return getNavigationNodeDAO().findAll();
	}

	@Override
	public void save(NavigationNode model) {
		// model.setDate(new Date());
		model.setNaviCreateDate(new Date());
		model.setNaviUpdateDate(new Date());
		navigationNodeDAO.save(model);
	}

	@Override
	public NavigationNode find(Long id) {
		return navigationNodeDAO.find(id);
	}

	@Override
	public void remove(NavigationNode model) {
		navigationNodeDAO.remove(model);
	}

	@Override
	public void remove(Long id) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(NavigationNode model) {

		model.setNaviUpdateDate(new Date());// model.setDate(new Date());
		navigationNodeDAO.merge(model);
		// TODO Auto-generated method stub

	}

	@Override
	public List<NavigationNode> findAll(Map<String, Object> mapCondition) {
		return navigationNodeDAO.searchList(mapCondition);
	}

	@Override
	public <T> List<T> searchList(String jpql, Map<String, Object> parameters,
			Class<T> entity) {
		return navigationNodeDAO.searchList(jpql, parameters, entity);
	}

}
